<?php

namespace App\Listeners\Train\TrainOrder;

use App\Events\Train\TrainOrder\Refund\TicketReturnApplyEvent;
use App\Models\Train\TrainOrders\Repositories\Interfaces\TrainOrdersRepositoryInterface;

class PassengerApplyRefundListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param object $event
     *
     * @return void
     */
    public function handle(TicketReturnApplyEvent $event)
    {
        $passenger = $event->passenger;
        /**
         * @var TrainOrdersRepositoryInterface $orderRepo
         */
        $orderRepo = app(TrainOrdersRepositoryInterface::class);
        $orderRepo->passengerApplyRefund($passenger);
    }
}
